package com.bitmain.mmst.core.global.listener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import com.bitmain.mmst.common.util.SpringContextHolder;
import com.bitmain.mmst.feature.cache.GlobalDataBuffer;

/**
 * 
 *
 * @author Richard - rui.wu@bitmain.com
 * @since 2016年7月28日 
 *
 */
public class ApplicationGlobalListener implements ApplicationListener<ApplicationEvent> {

	@Override
	public void onApplicationEvent(ApplicationEvent event) {
		if(event instanceof ContextRefreshedEvent){
			if(((ContextRefreshedEvent) event).getApplicationContext() == SpringContextHolder.getApplicationContext()){
				GlobalDataBuffer.refreshMinerTypes();
			}
		}
	}
}
